<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/corelib/tools/qrect.cpp -->
<head>
  <title>Qt 4.3: QRect Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QRect Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1>
<p>The QRect class defines a rectangle in the plane using integer precision. <a href="#details">More...</a></p>
<pre> #include &lt;QRect&gt;</pre><ul>
<li><a href="qrect-members.html">List of all members, including inherited members</a></li>
<li><a href="qrect-obsolete.html">Obsolete members</a></li>
<li><a href="qrect-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qrect.html#QRect">QRect</a></b> ()</li>
<li><div class="fn"/><b><a href="qrect.html#QRect-2">QRect</a></b> ( const QPoint &amp; <i>topLeft</i>, const QPoint &amp; <i>bottomRight</i> )</li>
<li><div class="fn"/><b><a href="qrect.html#QRect-3">QRect</a></b> ( const QPoint &amp; <i>topLeft</i>, const QSize &amp; <i>size</i> )</li>
<li><div class="fn"/><b><a href="qrect.html#QRect-4">QRect</a></b> ( int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#adjust">adjust</a></b> ( int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i> )</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#adjusted">adjusted</a></b> ( int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i> ) const</li>
<li><div class="fn"/>int <b><a href="qrect.html#bottom">bottom</a></b> () const</li>
<li><div class="fn"/>QPoint <b><a href="qrect.html#bottomLeft">bottomLeft</a></b> () const</li>
<li><div class="fn"/>QPoint <b><a href="qrect.html#bottomRight">bottomRight</a></b> () const</li>
<li><div class="fn"/>QPoint <b><a href="qrect.html#center">center</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#contains">contains</a></b> ( const QPoint &amp; <i>point</i>, bool <i>proper</i> = false ) const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#contains-2">contains</a></b> ( int <i>x</i>, int <i>y</i>, bool <i>proper</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#contains-3">contains</a></b> ( int <i>x</i>, int <i>y</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#contains-4">contains</a></b> ( const QRect &amp; <i>rectangle</i>, bool <i>proper</i> = false ) const</li>
<li><div class="fn"/>void <b><a href="qrect.html#getCoords">getCoords</a></b> ( int * <i>x1</i>, int * <i>y1</i>, int * <i>x2</i>, int * <i>y2</i> ) const</li>
<li><div class="fn"/>void <b><a href="qrect.html#getRect">getRect</a></b> ( int * <i>x</i>, int * <i>y</i>, int * <i>width</i>, int * <i>height</i> ) const</li>
<li><div class="fn"/>int <b><a href="qrect.html#height">height</a></b> () const</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#intersected">intersected</a></b> ( const QRect &amp; <i>rectangle</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#intersects">intersects</a></b> ( const QRect &amp; <i>rectangle</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#isEmpty">isEmpty</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#isNull">isNull</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qrect.html#isValid">isValid</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qrect.html#left">left</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveBottom">moveBottom</a></b> ( int <i>y</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveBottomLeft">moveBottomLeft</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveBottomRight">moveBottomRight</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveCenter">moveCenter</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveLeft">moveLeft</a></b> ( int <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveRight">moveRight</a></b> ( int <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveTo">moveTo</a></b> ( int <i>x</i>, int <i>y</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveTo-2">moveTo</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveTop">moveTop</a></b> ( int <i>y</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveTopLeft">moveTopLeft</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#moveTopRight">moveTopRight</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#normalized">normalized</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qrect.html#right">right</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qrect.html#setBottom">setBottom</a></b> ( int <i>y</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setBottomLeft">setBottomLeft</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setBottomRight">setBottomRight</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setCoords">setCoords</a></b> ( int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setHeight">setHeight</a></b> ( int <i>height</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setLeft">setLeft</a></b> ( int <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setRect">setRect</a></b> ( int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setRight">setRight</a></b> ( int <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setSize">setSize</a></b> ( const QSize &amp; <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setTop">setTop</a></b> ( int <i>y</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setTopLeft">setTopLeft</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setTopRight">setTopRight</a></b> ( const QPoint &amp; <i>position</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setWidth">setWidth</a></b> ( int <i>width</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setX">setX</a></b> ( int <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#setY">setY</a></b> ( int <i>y</i> )</li>
<li><div class="fn"/>QSize <b><a href="qrect.html#size">size</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qrect.html#top">top</a></b> () const</li>
<li><div class="fn"/>QPoint <b><a href="qrect.html#topLeft">topLeft</a></b> () const</li>
<li><div class="fn"/>QPoint <b><a href="qrect.html#topRight">topRight</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qrect.html#translate">translate</a></b> ( int <i>dx</i>, int <i>dy</i> )</li>
<li><div class="fn"/>void <b><a href="qrect.html#translate-2">translate</a></b> ( const QPoint &amp; <i>offset</i> )</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#translated">translated</a></b> ( int <i>dx</i>, int <i>dy</i> ) const</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#translated-2">translated</a></b> ( const QPoint &amp; <i>offset</i> ) const</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#united">united</a></b> ( const QRect &amp; <i>rectangle</i> ) const</li>
<li><div class="fn"/>int <b><a href="qrect.html#width">width</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qrect.html#x">x</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qrect.html#y">y</a></b> () const</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#operator-and">operator&amp;</a></b> ( const QRect &amp; <i>rectangle</i> ) const</li>
<li><div class="fn"/>QRect &amp; <b><a href="qrect.html#operator-and-eq">operator&amp;=</a></b> ( const QRect &amp; <i>rectangle</i> )</li>
<li><div class="fn"/>QRect <b><a href="qrect.html#operator-7c">operator|</a></b> ( const QRect &amp; <i>rectangle</i> ) const</li>
<li><div class="fn"/>QRect &amp; <b><a href="qrect.html#operator-7c-eq">operator|=</a></b> ( const QRect &amp; <i>rectangle</i> )</li>
</ul>
<a name="related-non-members"></a>
<h3>Related Non-Members</h3>
<ul>
<li><div class="fn"/>Q_CORE_EXPORT_INLINE <b><a href="qrect.html#operator-not-eq-15">operator!=</a></b> ( const QRect &amp; <i>r1</i>, const QRect &amp; <i>r2</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qrect.html#operator-lt-lt-47">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QRect &amp; <i>rectangle</i> )</li>
<li><div class="fn"/>Q_CORE_EXPORT_INLINE <b><a href="qrect.html#operator-eq-eq-24">operator==</a></b> ( const QRect &amp; <i>r1</i>, const QRect &amp; <i>r2</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qrect.html#operator-gt-gt-28">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QRect &amp; <i>rectangle</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QRect class defines a rectangle in the plane using integer precision.</p>
<p>A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.</p>
<p>A QRect can be constructed with a set of left, top, width and height integers, or from a <a href="qpoint.html">QPoint</a> and a <a href="qsize.html">QSize</a>. The following code creates two identical rectangles.</p>
<pre> QRect r1(100, 200, 11, 16);
 QRect r2(QPoint(100, 200), QSize(11, 16));</pre>
<p>There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the <a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#right">right</a>() functions deviate from the true bottom-right corner of the rectangle.</p>
<p>The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a <a href="qrect.html#moveTo">moveTo</a>() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the <a href="qrect.html#translate">translate</a>() function moves the rectangle the given offset relative to the current position, and the <a href="qrect.html#translated">translated</a>() function returns a translated copy of this rectangle.</p>
<p>The <a href="qrect.html#size">size</a>() function returns the rectange's dimensions as a <a href="qsize.html">QSize</a>. The dimensions can also be retrieved separately using the <a href="qrect.html#width">width</a>() and <a href="qrect.html#height">height</a>() functions. To manipulate the dimensions use the <a href="qrect.html#setSize">setSize</a>(), <a href="qrect.html#setWidth">setWidth</a>() or <a href="qrect.html#setHeight">setHeight</a>() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, <a href="qrect.html#setBottom">setBottom</a>() or <a href="qrect.html#setRight">setRight</a>().</p>
<p>The <a href="qrect.html#contains">contains</a>() function tells whether a given point is inside the rectangle or not, and the <a href="qrect.html#intersects">intersects</a>() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the <a href="qrect.html#intersected">intersected</a>() function which returns the intersection rectangle, and the <a href="qrect.html#united">united</a>() function which returns the rectangle that encloses the given rectangle and this:</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/qrect-intersect.png" /></td><td><img src="images/qrect-unite.png" /></td></tr>
<tr valign="top" class="even"><td><a href="qrect.html#intersected">intersected</a>()</td><td><a href="qrect.html#united">united</a>()</td></tr>
</table></p>
<p>The <a href="qrect.html#isEmpty">isEmpty</a>() function returns true if <a href="qrect.html#left">left</a>() &gt; <a href="qrect.html#right">right</a>() or <a href="qrect.html#top">top</a>() &gt; <a href="qrect.html#bottom">bottom</a>(). Note that an empty rectangle is not valid: The <a href="qrect.html#isValid">isValid</a>() function returns true if <a href="qrect.html#left">left</a>() &lt;= <a href="qrect.html#right">right</a>() <i>and</i> <a href="qrect.html#top">top</a>() &lt;= <a href="qrect.html#bottom">bottom</a>(). A null rectangle (<a href="qrect.html#isNull">isNull</a>() == true) on the other hand, has both width and height set to 0.</p>
<p>Note that due to the way QRect and <a href="qrectf.html">QRectF</a> are defined, an empty QRect is defined in essentially the same way as <a href="qrectf.html">QRectF</a>.</p>
<p>Finally, QRect objects can be streamed as well as compared.</p>
<ul><li><a href="#rendering">Rendering</a></li>
<li><a href="#coordinates">Coordinates</a></li>
</ul>
<a name="rendering"></a>
<h3>Rendering</h3>
<p>When using an <a href="qpainter.html#RenderHint-enum">anti-aliased</a> painter, the boundary line of a QRect will be rendered symmetrically on both sides of the mathematical rectangle's boundary line. But when using an aliased painter (the default) other rules apply.</p>
<p>Then, when rendering with a one pixel wide pen the QRect's boundary line will be rendered to the right and below the mathematical rectangle's boundary line.</p>
<p>When rendering with a two pixels wide pen the boundary line will be split in the middle by the mathematical rectangle. This will be the case whenever the pen is set to an even number of pixels, while rendering with a pen with an odd number of pixels, the spare pixel will be rendered to the right and below the mathematical rectangle as in the one pixel case.</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/qrect-diagram-zero.png" /></td><td><img src="images/qrect-diagram-one.png" /></td></tr>
<tr valign="top" class="even"><td>Logical representation</td><td>One pixel wide pen</td></tr>
<tr valign="top" class="odd"><td><img src="images/qrect-diagram-two.png" /></td><td><img src="images/qrect-diagram-three.png" /></td></tr>
<tr valign="top" class="even"><td>Two pixel wide pen</td><td>Three pixel wide pen</td></tr>
</table></p>
<a name="coordinates"></a>
<h3>Coordinates</h3>
<p>The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates.</p>
<p>For example the <a href="qrect.html#left">left</a>(), <a href="qrect.html#setLeft">setLeft</a>() and <a href="qrect.html#moveLeft">moveLeft</a>() functions as an example: <a href="qrect.html#left">left</a>() returns the x-coordinate of the rectangle's left edge, <a href="qrect.html#setLeft">setLeft</a>() sets the left edge of the rectangle to the given x coordinate (it may change the width, but will never change the rectangle's right edge) and <a href="qrect.html#moveLeft">moveLeft</a>() moves the entire rectangle horizontally, leaving the rectangle's left edge at the given x coordinate and its size unchanged.</p>
<p align="center"><img src="images/qrect-coordinates.png" /></p><p>Note that for historical reasons the values returned by the <a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#right">right</a>() functions deviate from the true bottom-right corner of the rectangle: The <a href="qrect.html#right">right</a>() function returns <i> <a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() - 1</i> and the <a href="qrect.html#bottom">bottom</a>() function returns <i><a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1</i>. The same is the case for the point returned by the <a href="qrect.html#bottomRight">bottomRight</a>() convenience function. In addition, the x and y coordinate of the <a href="qrect.html#topRight">topRight</a>() and <a href="qrect.html#bottomLeft">bottomLeft</a>() functions, respectively, contain the same deviation from the true right and bottom edges.</p>
<p>We recommend that you use <a href="qrect.html#x">x</a>() + <a href="qrect.html#width">width</a>() and <a href="qrect.html#y">y</a>() + <a href="qrect.html#height">height</a>() to find the true bottom-right corner, and avoid <a href="qrect.html#right">right</a>() and <a href="qrect.html#bottom">bottom</a>(). Another solution is to use <a href="qrectf.html">QRectF</a>: The <a href="qrectf.html">QRectF</a> class defines a rectangle in the plane using floating point accuracy for coordinates, and the <a href="qrectf.html#right">QRectF::right</a>() and <a href="qrectf.html#bottom">QRectF::bottom</a>() functions <i>do</i> return the right and bottom coordinates.</p>
<p>It is also possible to add offsets to this rectangle's coordinates using the <a href="qrect.html#adjust">adjust</a>() function, as well as retrieve a new rectangle based on adjustments of the original one using the <a href="qrect.html#adjusted">adjusted</a>() function. If either of the width and height is negative, use the <a href="qrect.html#normalized">normalized</a>() function to retrieve a rectangle where the corners are swapped.</p>
<p>In addition, QRect provides the <a href="qrect.html#getCoords">getCoords</a>() function which extracts the position of the rectangle's top-left and bottom-right corner, and the <a href="qrect.html#getRect">getRect</a>() function which extracts the rectangle's top-left corner, width and height. Use the <a href="qrect.html#setCoords">setCoords</a>() and <a href="qrect.html#setRect">setRect</a>() function to manipulate the rectangle's coordinates and dimensions in one go.</p>
<p>See also <a href="qrectf.html">QRectF</a> and <a href="qregion.html">QRegion</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QRect"></a>QRect::QRect ()</h3>
<p>Constructs a null rectangle.</p>
<p>See also <a href="qrect.html#isNull">isNull</a>().</p>
<h3 class="fn"><a name="QRect-2"></a>QRect::QRect ( const <a href="qpoint.html">QPoint</a> &amp; <i>topLeft</i>, const <a href="qpoint.html">QPoint</a> &amp; <i>bottomRight</i> )</h3>
<p>Constructs a rectangle with the given <i>topLeft</i> and <i>bottomRight</i> corners.</p>
<p>See also <a href="qrect.html#setTopLeft">setTopLeft</a>() and <a href="qrect.html#setBottomRight">setBottomRight</a>().</p>
<h3 class="fn"><a name="QRect-3"></a>QRect::QRect ( const <a href="qpoint.html">QPoint</a> &amp; <i>topLeft</i>, const <a href="qsize.html">QSize</a> &amp; <i>size</i> )</h3>
<p>Constructs a rectangle with the given <i>topLeft</i> corner and the given <i>size</i>.</p>
<p>See also <a href="qrect.html#setTopLeft">setTopLeft</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<h3 class="fn"><a name="QRect-4"></a>QRect::QRect ( int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i> )</h3>
<p>Constructs a rectangle with (<i>x</i>, <i>y</i>) as its top-left corner and the given <i>width</i> and <i>height</i>.</p>
<p>See also <a href="qrect.html#setRect">setRect</a>().</p>
<h3 class="fn"><a name="adjust"></a>void QRect::adjust ( int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i> )</h3>
<p>Adds <i>dx1</i>, <i>dy1</i>, <i>dx2</i> and <i>dy2</i> respectively to the existing coordinates of the rectangle.</p>
<p>See also <a href="qrect.html#adjusted">adjusted</a>() and <a href="qrect.html#setRect">setRect</a>().</p>
<h3 class="fn"><a name="adjusted"></a>QRect QRect::adjusted ( int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i> ) const</h3>
<p>Returns a new rectangle with <i>dx1</i>, <i>dy1</i>, <i>dx2</i> and <i>dy2</i> added respectively to the existing coordinates of this rectangle.</p>
<p>See also <a href="qrect.html#adjust">adjust</a>().</p>
<h3 class="fn"><a name="bottom"></a>int QRect::bottom () const</h3>
<p>Returns the y-coordinate of the rectangle's bottom edge.</p>
<p>Note that for historical reasons this function returns <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1; use <a href="qrect.html#y">y</a>() + <a href="qrect.html#height">height</a>() to retrieve the true y-coordinate.</p>
<p>See also <a href="qrect.html#setBottom">setBottom</a>(), <a href="qrect.html#bottomLeft">bottomLeft</a>(), and <a href="qrect.html#bottomRight">bottomRight</a>().</p>
<h3 class="fn"><a name="bottomLeft"></a><a href="qpoint.html">QPoint</a> QRect::bottomLeft () const</h3>
<p>Returns the position of the rectangle's bottom-left corner. Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>(), <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1).</p>
<p>See also <a href="qrect.html#setBottomLeft">setBottomLeft</a>(), <a href="qrect.html#bottom">bottom</a>(), and <a href="qrect.html#left">left</a>().</p>
<h3 class="fn"><a name="bottomRight"></a><a href="qpoint.html">QPoint</a> QRect::bottomRight () const</h3>
<p>Returns the position of the rectangle's bottom-right corner.</p>
<p>Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() -1, <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1).</p>
<p>See also <a href="qrect.html#setBottomRight">setBottomRight</a>(), <a href="qrect.html#bottom">bottom</a>(), and <a href="qrect.html#right">right</a>().</p>
<h3 class="fn"><a name="center"></a><a href="qpoint.html">QPoint</a> QRect::center () const</h3>
<p>Returns the center point of the rectangle.</p>
<p>See also <a href="qrect.html#moveCenter">moveCenter</a>().</p>
<h3 class="fn"><a name="contains"></a>bool QRect::contains ( const <a href="qpoint.html">QPoint</a> &amp; <i>point</i>, bool <i>proper</i> = false ) const</h3>
<p>Returns true if the the given <i>point</i> is inside or on the edge of the rectangle, otherwise returns false. If <i>proper</i> is true, this function only returns true if the given <i>point</i> is <i>inside</i> the rectangle (i.e&#x2e;, not on the edge).</p>
<p>See also <a href="qrect.html#intersects">intersects</a>().</p>
<h3 class="fn"><a name="contains-2"></a>bool QRect::contains ( int <i>x</i>, int <i>y</i>, bool <i>proper</i> ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the point (<i>x</i>, <i>y</i>) is inside or on the edge of the rectangle, otherwise returns false. If <i>proper</i> is true, this function only returns true if the point is entirely inside the rectangle(not on the edge).</p>
<h3 class="fn"><a name="contains-3"></a>bool QRect::contains ( int <i>x</i>, int <i>y</i> ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the point (<i>x</i>, <i>y</i>) is inside this rectangle, otherwise returns false.</p>
<h3 class="fn"><a name="contains-4"></a>bool QRect::contains ( const QRect &amp; <i>rectangle</i>, bool <i>proper</i> = false ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the given <i>rectangle</i> is inside this rectangle. otherwise returns false. If <i>proper</i> is true, this function only returns true if the <i>rectangle</i> is entirely inside this rectangle (not on the edge).</p>
<h3 class="fn"><a name="getCoords"></a>void QRect::getCoords ( int * <i>x1</i>, int * <i>y1</i>, int * <i>x2</i>, int * <i>y2</i> ) const</h3>
<p>Extracts the position of the rectangle's top-left corner to *<i>x1</i> and *<i>y1</i>, and the position of the bottom-right corner to *<i>x2</i> and *<i>y2</i>.</p>
<p>See also <a href="qrect.html#setCoords">setCoords</a>() and <a href="qrect.html#getRect">getRect</a>().</p>
<h3 class="fn"><a name="getRect"></a>void QRect::getRect ( int * <i>x</i>, int * <i>y</i>, int * <i>width</i>, int * <i>height</i> ) const</h3>
<p>Extracts the position of the rectangle's top-left corner to *<i>x</i> and *<i>y</i>, and its dimensions to *<i>width</i> and *<i>height</i>.</p>
<p>See also <a href="qrect.html#setRect">setRect</a>() and <a href="qrect.html#getCoords">getCoords</a>().</p>
<h3 class="fn"><a name="height"></a>int QRect::height () const</h3>
<p>Returns the height of the rectangle.</p>
<p>See also <a href="qrect.html#setHeight">setHeight</a>(), <a href="qrect.html#width">width</a>(), and <a href="qrect.html#size">size</a>().</p>
<h3 class="fn"><a name="intersected"></a>QRect QRect::intersected ( const QRect &amp; <i>rectangle</i> ) const</h3>
<p>Returns the intersection of this rectangle and the given <i>rectangle</i>. Note that <tt>r.intersected(s)</tt> is equivalent to <tt>r &amp; s</tt>.</p>
<p align="center"><img src="images/qrect-intersect.png" /></p><p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qrect.html#intersects">intersects</a>(), <a href="qrect.html#united">united</a>(), and <a href="qrect.html#operator-and-eq">operator&amp;=</a>().</p>
<h3 class="fn"><a name="intersects"></a>bool QRect::intersects ( const QRect &amp; <i>rectangle</i> ) const</h3>
<p>Returns true if this rectangle intersects with the given <i>rectangle</i> (i.e&#x2e;, there is at least one pixel that is within both rectangles), otherwise returns false.</p>
<p>The intersection rectangle can be retrieved using the <a href="qrect.html#intersected">intersected</a>() function.</p>
<p>See also <a href="qrect.html#contains">contains</a>().</p>
<h3 class="fn"><a name="isEmpty"></a>bool QRect::isEmpty () const</h3>
<p>Returns true if the rectangle is empty, otherwise returns false.</p>
<p>An empty rectangle has a <a href="qrect.html#left">left</a>() &gt; <a href="qrect.html#right">right</a>() or <a href="qrect.html#top">top</a>() &gt; <a href="qrect.html#bottom">bottom</a>(). An empty rectangle is not valid (i.e&#x2e;, isEmpty() == !<a href="qrect.html#isValid">isValid</a>()).</p>
<p>Use the <a href="qrect.html#normalized">normalized</a>() function to retrieve a rectangle where the corners are swapped.</p>
<p>See also <a href="qrect.html#isNull">isNull</a>(), <a href="qrect.html#isValid">isValid</a>(), and <a href="qrect.html#normalized">normalized</a>().</p>
<h3 class="fn"><a name="isNull"></a>bool QRect::isNull () const</h3>
<p>Returns true if the rectangle is a null rectangle, otherwise returns false.</p>
<p>A null rectangle has both the width and the height set to 0 (i.e&#x2e;, <a href="qrect.html#right">right</a>() == <a href="qrect.html#left">left</a>() - 1 and <a href="qrect.html#bottom">bottom</a>() == <a href="qrect.html#top">top</a>() - 1). A null rectangle is also empty, and hence is not valid.</p>
<p>See also <a href="qrect.html#isEmpty">isEmpty</a>() and <a href="qrect.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="isValid"></a>bool QRect::isValid () const</h3>
<p>Returns true if the rectangle is valid, otherwise returns false.</p>
<p>A valid rectangle has a <a href="qrect.html#left">left</a>() &lt; <a href="qrect.html#right">right</a>() and <a href="qrect.html#top">top</a>() &lt; <a href="qrect.html#bottom">bottom</a>(). Note that non-trivial operations like intersections are not defined for invalid rectangles. A valid rectangle is not empty (i.e&#x2e;, isValid() == !<a href="qrect.html#isEmpty">isEmpty</a>()).</p>
<p>See also <a href="qrect.html#isNull">isNull</a>(), <a href="qrect.html#isEmpty">isEmpty</a>(), and <a href="qrect.html#normalized">normalized</a>().</p>
<h3 class="fn"><a name="left"></a>int QRect::left () const</h3>
<p>Returns the x-coordinate of the rectangle's left edge. Equivalent to <a href="qrect.html#x">x</a>().</p>
<p>See also <a href="qrect.html#setLeft">setLeft</a>(), <a href="qrect.html#topLeft">topLeft</a>(), and <a href="qrect.html#bottomLeft">bottomLeft</a>().</p>
<h3 class="fn"><a name="moveBottom"></a>void QRect::moveBottom ( int <i>y</i> )</h3>
<p>Moves the rectangle vertically, leaving the rectangle's bottom edge at the given <i>y</i> coordinate. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#bottom">bottom</a>(), <a href="qrect.html#setBottom">setBottom</a>(), and <a href="qrect.html#moveTop">moveTop</a>().</p>
<h3 class="fn"><a name="moveBottomLeft"></a>void QRect::moveBottomLeft ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Moves the rectangle, leaving the bottom-left corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#setBottomLeft">setBottomLeft</a>(), <a href="qrect.html#moveBottom">moveBottom</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<h3 class="fn"><a name="moveBottomRight"></a>void QRect::moveBottomRight ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Moves the rectangle, leaving the bottom-right corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#setBottomRight">setBottomRight</a>(), <a href="qrect.html#moveRight">moveRight</a>(), and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<h3 class="fn"><a name="moveCenter"></a>void QRect::moveCenter ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Moves the rectangle, leaving the center point at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#center">center</a>().</p>
<h3 class="fn"><a name="moveLeft"></a>void QRect::moveLeft ( int <i>x</i> )</h3>
<p>Moves the rectangle horizontally, leaving the rectangle's left edge at the given <i>x</i> coordinate. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#left">left</a>(), <a href="qrect.html#setLeft">setLeft</a>(), and <a href="qrect.html#moveRight">moveRight</a>().</p>
<h3 class="fn"><a name="moveRight"></a>void QRect::moveRight ( int <i>x</i> )</h3>
<p>Moves the rectangle horizontally, leaving the rectangle's right edge at the given <i>x</i> coordinate. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#right">right</a>(), <a href="qrect.html#setRight">setRight</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<h3 class="fn"><a name="moveTo"></a>void QRect::moveTo ( int <i>x</i>, int <i>y</i> )</h3>
<p>Moves the rectangle, leaving the top-left corner at the given position (<i>x</i>, <i>y</i>). The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#translate">translate</a>() and <a href="qrect.html#moveTopLeft">moveTopLeft</a>().</p>
<h3 class="fn"><a name="moveTo-2"></a>void QRect::moveTo ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Moves the rectangle, leaving the top-left corner at the given <i>position</i>.</p>
<h3 class="fn"><a name="moveTop"></a>void QRect::moveTop ( int <i>y</i> )</h3>
<p>Moves the rectangle vertically, leaving the rectangle's top edge at the given <i>y</i> coordinate. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#top">top</a>(), <a href="qrect.html#setTop">setTop</a>(), and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<h3 class="fn"><a name="moveTopLeft"></a>void QRect::moveTopLeft ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Moves the rectangle, leaving the top-left corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#setTopLeft">setTopLeft</a>(), <a href="qrect.html#moveTop">moveTop</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<h3 class="fn"><a name="moveTopRight"></a>void QRect::moveTopRight ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Moves the rectangle, leaving the top-right corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p>See also <a href="qrect.html#setTopRight">setTopRight</a>(), <a href="qrect.html#moveTop">moveTop</a>(), and <a href="qrect.html#moveRight">moveRight</a>().</p>
<h3 class="fn"><a name="normalized"></a>QRect QRect::normalized () const</h3>
<p>Returns a normalized rectangle; i.e&#x2e;, a rectangle that has a non-negative width and height.</p>
<p>If <a href="qrect.html#width">width</a>() &lt; 0 the function swaps the left and right corners, and it swaps the top and bottom corners if <a href="qrect.html#height">height</a>() &lt; 0.</p>
<p>See also <a href="qrect.html#isValid">isValid</a>() and <a href="qrect.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="right"></a>int QRect::right () const</h3>
<p>Returns the x-coordinate of the rectangle's right edge.</p>
<p>Note that for historical reasons this function returns <a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() - 1; use <a href="qrect.html#x">x</a>() + <a href="qrect.html#width">width</a>() to retrieve the true x-coordinate.</p>
<p>See also <a href="qrect.html#setRight">setRight</a>(), <a href="qrect.html#topRight">topRight</a>(), and <a href="qrect.html#bottomRight">bottomRight</a>().</p>
<h3 class="fn"><a name="setBottom"></a>void QRect::setBottom ( int <i>y</i> )</h3>
<p>Sets the bottom edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the top edge of the rectangle.</p>
<p>See also <a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<h3 class="fn"><a name="setBottomLeft"></a>void QRect::setBottomLeft ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Set the bottom-left corner of the rectangle to the given <i>position</i>. May change the size, but will the never change the top-right corner of the rectangle.</p>
<p>See also <a href="qrect.html#bottomLeft">bottomLeft</a>() and <a href="qrect.html#moveBottomLeft">moveBottomLeft</a>().</p>
<h3 class="fn"><a name="setBottomRight"></a>void QRect::setBottomRight ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Set the bottom-right corner of the rectangle to the given <i>position</i>. May change the size, but will the never change the top-left corner of the rectangle.</p>
<p>See also <a href="qrect.html#bottomRight">bottomRight</a>() and <a href="qrect.html#moveBottomRight">moveBottomRight</a>().</p>
<h3 class="fn"><a name="setCoords"></a>void QRect::setCoords ( int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i> )</h3>
<p>Sets the coordinates of the rectangle's top-left corner to (<i>x1</i>, <i>y1</i>), and the coordinates of its bottom-right corner to (<i>x2</i>, <i>y2</i>).</p>
<p>See also <a href="qrect-qt3.html#coords">coords</a>(), <a href="qrect.html#getCoords">getCoords</a>(), and <a href="qrect.html#setRect">setRect</a>().</p>
<h3 class="fn"><a name="setHeight"></a>void QRect::setHeight ( int <i>height</i> )</h3>
<p>Sets the height of the rectangle to the given <i>height</i>. The bottom edge is changed, but not the top one.</p>
<p>See also <a href="qrect.html#height">height</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<h3 class="fn"><a name="setLeft"></a>void QRect::setLeft ( int <i>x</i> )</h3>
<p>Sets the left edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the right edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setX">setX</a>().</p>
<p>See also <a href="qrect.html#left">left</a>() and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<h3 class="fn"><a name="setRect"></a>void QRect::setRect ( int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i> )</h3>
<p>Sets the coordinates of the rectangle's top-left corner to (<i>x</i>, <i>y</i>), and its size to the given <i>width</i> and <i>height</i>.</p>
<p>See also <a href="qrect-qt3.html#rect">rect</a>(), <a href="qrect.html#getRect">getRect</a>(), and <a href="qrect.html#setCoords">setCoords</a>().</p>
<h3 class="fn"><a name="setRight"></a>void QRect::setRight ( int <i>x</i> )</h3>
<p>Sets the right edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the left edge of the rectangle.</p>
<p>See also <a href="qrect.html#right">right</a>() and <a href="qrect.html#moveRight">moveRight</a>().</p>
<h3 class="fn"><a name="setSize"></a>void QRect::setSize ( const <a href="qsize.html">QSize</a> &amp; <i>size</i> )</h3>
<p>Sets the size of the rectangle to the given <i>size</i>. The top-left corner is not moved.</p>
<p>See also <a href="qrect.html#size">size</a>(), <a href="qrect.html#setWidth">setWidth</a>(), and <a href="qrect.html#setHeight">setHeight</a>().</p>
<h3 class="fn"><a name="setTop"></a>void QRect::setTop ( int <i>y</i> )</h3>
<p>Sets the top edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the bottom edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setY">setY</a>().</p>
<p>See also <a href="qrect.html#top">top</a>() and <a href="qrect.html#moveTop">moveTop</a>().</p>
<h3 class="fn"><a name="setTopLeft"></a>void QRect::setTopLeft ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Set the top-left corner of the rectangle to the given <i>position</i>. May change the size, but will the never change the bottom-right corner of the rectangle.</p>
<p>See also <a href="qrect.html#topLeft">topLeft</a>() and <a href="qrect.html#moveTopLeft">moveTopLeft</a>().</p>
<h3 class="fn"><a name="setTopRight"></a>void QRect::setTopRight ( const <a href="qpoint.html">QPoint</a> &amp; <i>position</i> )</h3>
<p>Set the top-right corner of the rectangle to the given <i>position</i>. May change the size, but will the never change the bottom-left corner of the rectangle.</p>
<p>See also <a href="qrect.html#topRight">topRight</a>() and <a href="qrect.html#moveTopRight">moveTopRight</a>().</p>
<h3 class="fn"><a name="setWidth"></a>void QRect::setWidth ( int <i>width</i> )</h3>
<p>Sets the width of the rectangle to the given <i>width</i>. The right edge is changed, but not the left one.</p>
<p>See also <a href="qrect.html#width">width</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<h3 class="fn"><a name="setX"></a>void QRect::setX ( int <i>x</i> )</h3>
<p>Sets the left edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the right edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setLeft">setLeft</a>().</p>
<p>See also <a href="qrect.html#x">x</a>(), <a href="qrect.html#setY">setY</a>(), and <a href="qrect.html#setTopLeft">setTopLeft</a>().</p>
<h3 class="fn"><a name="setY"></a>void QRect::setY ( int <i>y</i> )</h3>
<p>Sets the top edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the bottom edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setTop">setTop</a>().</p>
<p>See also <a href="qrect.html#y">y</a>(), <a href="qrect.html#setX">setX</a>(), and <a href="qrect.html#setTopLeft">setTopLeft</a>().</p>
<h3 class="fn"><a name="size"></a><a href="qsize.html">QSize</a> QRect::size () const</h3>
<p>Returns the size of the rectangle.</p>
<p>See also <a href="qrect.html#setSize">setSize</a>(), <a href="qrect.html#width">width</a>(), and <a href="qrect.html#height">height</a>().</p>
<h3 class="fn"><a name="top"></a>int QRect::top () const</h3>
<p>Returns the y-coordinate of the rectangle's top edge. Equivalent to <a href="qrect.html#y">y</a>().</p>
<p>See also <a href="qrect.html#setTop">setTop</a>(), <a href="qrect.html#topLeft">topLeft</a>(), and <a href="qrect.html#topRight">topRight</a>().</p>
<h3 class="fn"><a name="topLeft"></a><a href="qpoint.html">QPoint</a> QRect::topLeft () const</h3>
<p>Returns the position of the rectangle's top-left corner.</p>
<p>See also <a href="qrect.html#setTopLeft">setTopLeft</a>(), <a href="qrect.html#top">top</a>(), and <a href="qrect.html#left">left</a>().</p>
<h3 class="fn"><a name="topRight"></a><a href="qpoint.html">QPoint</a> QRect::topRight () const</h3>
<p>Returns the position of the rectangle's top-right corner.</p>
<p>Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() -1, <a href="qrect.html#top">top</a>()).</p>
<p>See also <a href="qrect.html#setTopRight">setTopRight</a>(), <a href="qrect.html#top">top</a>(), and <a href="qrect.html#right">right</a>().</p>
<h3 class="fn"><a name="translate"></a>void QRect::translate ( int <i>dx</i>, int <i>dy</i> )</h3>
<p>Moves the rectangle <i>dx</i> along the x axis and <i>dy</i> along the y axis, relative to the current position. Positive values move the rectangle to the right and down.</p>
<p>See also <a href="qrect.html#moveTopLeft">moveTopLeft</a>(), <a href="qrect.html#moveTo">moveTo</a>(), and <a href="qrect.html#translated">translated</a>().</p>
<h3 class="fn"><a name="translate-2"></a>void QRect::translate ( const <a href="qpoint.html">QPoint</a> &amp; <i>offset</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Moves the rectangle <i>offset</i>.<a href="qpoint.html#x">x()</a> along the x axis and <i>offset</i>.<a href="qpoint.html#y">y()</a> along the y axis, relative to the current position.</p>
<h3 class="fn"><a name="translated"></a>QRect QRect::translated ( int <i>dx</i>, int <i>dy</i> ) const</h3>
<p>Returns a copy of the rectangle that is translated <i>dx</i> along the x axis and <i>dy</i> along the y axis, relative to the current position. Positive values move the rectangle to the right and down.</p>
<p>See also <a href="qrect.html#translate">translate</a>().</p>
<h3 class="fn"><a name="translated-2"></a>QRect QRect::translated ( const <a href="qpoint.html">QPoint</a> &amp; <i>offset</i> ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a copy of the rectangle that is translated <i>offset</i>.<a href="qpoint.html#x">x()</a> along the x axis and <i>offset</i>.<a href="qpoint.html#y">y()</a> along the y axis, relative to the current position.</p>
<h3 class="fn"><a name="united"></a>QRect QRect::united ( const QRect &amp; <i>rectangle</i> ) const</h3>
<p>Returns the bounding rectangle of this rectangle and the given <i>rectangle</i>.</p>
<p align="center"><img src="images/qrect-unite.png" /></p><p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qrect.html#intersected">intersected</a>().</p>
<h3 class="fn"><a name="width"></a>int QRect::width () const</h3>
<p>Returns the width of the rectangle.</p>
<p>See also <a href="qrect.html#setWidth">setWidth</a>(), <a href="qrect.html#height">height</a>(), and <a href="qrect.html#size">size</a>().</p>
<h3 class="fn"><a name="x"></a>int QRect::x () const</h3>
<p>Returns the x-coordinate of the rectangle's left edge. Equivalent to <a href="qrect.html#left">left</a>().</p>
<p>See also <a href="qrect.html#setX">setX</a>(), <a href="qrect.html#y">y</a>(), and <a href="qrect.html#topLeft">topLeft</a>().</p>
<h3 class="fn"><a name="y"></a>int QRect::y () const</h3>
<p>Returns the y-coordinate of the rectangle's top edge. Equivalent to <a href="qrect.html#top">top</a>().</p>
<p>See also <a href="qrect.html#setY">setY</a>(), <a href="qrect.html#x">x</a>(), and <a href="qrect.html#topLeft">topLeft</a>().</p>
<h3 class="fn"><a name="operator-and"></a>QRect QRect::operator&amp; ( const QRect &amp; <i>rectangle</i> ) const</h3>
<p>Returns the intersection of this rectangle and the given <i>rectangle</i>. Returns an empty rectangle if there is no intersection.</p>
<p>See also <a href="qrect.html#operator-and-eq">operator&amp;=</a>() and <a href="qrect.html#intersected">intersected</a>().</p>
<h3 class="fn"><a name="operator-and-eq"></a>QRect &amp; QRect::operator&amp;= ( const QRect &amp; <i>rectangle</i> )</h3>
<p>Intersects this rectangle with the given <i>rectangle</i>.</p>
<p>See also <a href="qrect.html#intersected">intersected</a>() and <a href="qrect.html#operator-and">operator&amp;</a>().</p>
<h3 class="fn"><a name="operator-7c"></a>QRect QRect::operator| ( const QRect &amp; <i>rectangle</i> ) const</h3>
<p>Returns the bounding rectangle of this rectangle and the given <i>rectangle</i>.</p>
<p>See also <a href="qrect.html#operator-7c-eq">operator|=</a>() and <a href="qrect.html#united">united</a>().</p>
<h3 class="fn"><a name="operator-7c-eq"></a>QRect &amp; QRect::operator|= ( const QRect &amp; <i>rectangle</i> )</h3>
<p>Unites this rectangle with the given <i>rectangle</i>.</p>
<p>See also <a href="qrect.html#united">united</a>() and <a href="qrect.html#operator-7c">operator|</a>().</p>
<hr />
<h2>Related Non-Members</h2>
<h3 class="fn"><a name="operator-not-eq-15"></a>Q_CORE_EXPORT_INLINE operator!= ( const QRect &amp; <i>r1</i>, const QRect &amp; <i>r2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the rectangles <i>r1</i> and <i>r2</i> are different, otherwise returns false.</p>
<h3 class="fn"><a name="operator-lt-lt-47"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, const QRect &amp; <i>rectangle</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Writes the given <i>rectangle</i> to the given <i>stream</i>, and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<h3 class="fn"><a name="operator-eq-eq-24"></a>Q_CORE_EXPORT_INLINE operator== ( const QRect &amp; <i>r1</i>, const QRect &amp; <i>r2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the rectangles <i>r1</i> and <i>r2</i> are equal, otherwise returns false.</p>
<h3 class="fn"><a name="operator-gt-gt-28"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, QRect &amp; <i>rectangle</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Reads a rectangle from the given <i>stream</i> into the given <i>rectangle</i>, and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
